package com.edu.web.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.edu.entity.Shop;
import com.edu.entity.Shopping;
import com.edu.service.UserService;
import com.edu.service.impl.UserServiceImpl;

/**
 * Servlet implementation class shopServlet
 */
@WebServlet("/shopServlet")
public class shopServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public shopServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		UserService shopService=new UserServiceImpl();
		Map<String,List<Shop>> map=shopService.query();
		request.setAttribute("map", map);
		Map<String,List<Shop>> newmap=shopService.queryall();
		request.setAttribute("newmap", newmap);
		List<Shop> list= shopService.querys();
		request.setAttribute("list", list);
		List<Shop> lists= shopService.queryby();
		request.setAttribute("lists", lists);
		List<Shop> listd= shopService.querybyId();
		request.setAttribute("listd", listd);
		List<Shop> listed=shopService.queryalls();
		request.setAttribute("listed", listed);
		List<Shop> newlist=shopService.select();
		request.setAttribute("newlist",newlist );
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
